
	jQuery(document).ready(function() {
		loadloginstat();
		getUser();
	});
function loadloginstat(){
	var content='<p  class="splogin1">'+
								'<a id="logina" href="login.html" class="indexa" target="_blank"></a>'+
							'</p>'+
							'<p id="username" class="splogin2"></p>'+
							'<p  class="spzc">'+
								'<a id="registerbtn" href="register.html" class="indexa" target="_blank"></a>'+
							'</p>';
	$('.splogin').append(content);
							
}
function getUser(){
		$.ajax({
			type: "get",
			url: requesturl + "user/user",
			async: false,
			xhrFields: {
				withCredentials: true
			},
			success: function(data) {
				if(data.status == "success") {
					$('#username').html(data.data.phone+'，欢迎您！');
					$('#logina').html('');
					$('#registera').html('');
				} else {
					$('#username').html('');
					$('#logina').html('登录');
					$('#registerbtn').html('注册');
				}
			},
			error: function(data) {
				alert("网络原因发送失败：" + data.responseText);
			}
		});
	}
function getUserModel(){
	var value = null;
		$.ajax({
			type: "get",
			url: requesturl + "user/user",
			async: false,
			xhrFields: {
				withCredentials: true
			},
			success: function(data) {
				if(data.status == "success") {
					value= data.data;
				} else {
				}
			},
			error: function(data) {
				alert("网络原因发送失败：" + data.responseText);
			}
		});
		return value;
	}
function getGoodsModel(goodid){
	var value = null;
		$.ajax({
			type: "get",
			url: requesturl + "goods/detail",
			async: false,
			xhrFields: {
				withCredentials: true
			},
			data:{
				'goodid':goodid
			},
			success: function(data) {
				if(data.status == "success") {
					value= data.data;
				} else {
				}
			},
			error: function(data) {
				alert("网络原因发送失败：" + data.responseText);
			}
		});
		return value
	}
function getNormModel(normsequence){
	var value = null;
		$.ajax({
			type: "post",
			url: requesturl + "producttype/norms/",
			async: false,
			xhrFields: {
				withCredentials: true
			},
			data:{
				'normsequence':normsequence
			},
			success: function(data) {
				if(data.status == "success") {
					value= data.data;
				} else {
				}
			},
			error: function(data) {
				alert("网络原因发送失败：" + data.responseText);
			}
		});
		return value;
	}
